package cc.rengu.igas.share.facade.bean.cups;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;

import java.util.Arrays;

/**
 * F60.3.1   特殊计费类型
 * F60.3.2   特殊计费档次取值
 *
 * @author fangminwei
 * @date 2021/4/17
 */
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum F60_3_1_SpecialCalcFeeEnum {
    _00_0("000", "无特殊计费类型-无特殊计费档次"),
    _01_0("010", "周期计费-月结且计费标准按照 MCC 本身标准执行"),
    _01_1("011", "周期计费-月结且计费标准不按照 MCC 对应的标准执行"),
    _02_0("020", "微额打包计费-无特殊计费档次"),
    _03_0("030", "固定比例计费-无特殊计费档次"),
    _04_0("040", "县乡优惠-普通商户"),
    _04_1("041", "县乡优惠-三农商户"),
    _05_0("050", "大商户优惠-大商户优惠 1 级"),
    _05_1("051", "大商户优惠-大商户优惠 2 级"),
    _05_2("052", "大商户优惠-大商户优惠 3 级"),
    ;

    private String code;
    private String desc;

    F60_3_1_SpecialCalcFeeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + "-" + desc;
    }

    public static F60_3_1_SpecialCalcFeeEnum find(String code) {
        F60_3_1_SpecialCalcFeeEnum result = Arrays.stream(F60_3_1_SpecialCalcFeeEnum.values())
                .filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        if (result == null) {
            throw new BizException(OltpRpcdEnum.PARAM_IS_EMPTY_OR_NULL.getRespCode(), "找不到对应的枚举信息" + code);
        }
        return result;
    }
}
